Add ruby-rbs-sys Rust crate with FFI bindings for RBS parser#47
Add ruby-rbs-sys Rust crate with FFI bindings for RBS parser#47alexcrocha wants to merge 1 commit intomasterfrom
Conversation
|
^ Looks like Rust CI is working as intended 👀 |
825c965 to
223d780
Compare
rust/ruby-rbs-sys/build.rs
Outdated
| fn source_files<P: AsRef<Path>>(root_dir: P) -> Vec<String> { | ||
| let mut files = Vec::new(); | ||
|
|
||
| for entry in fs::read_dir(root_dir.as_ref()).unwrap() { |
There was a problem hiding this comment.
| for entry in fs::read_dir(root_dir.as_ref()).unwrap() { | |
| for entry in fs::read_dir(root_dir.as_ref()).map_err(|e| format!("Failed to read source directory: {}", e))? { |
There was a problem hiding this comment.
Similarly here, if you map the error into a string, what happens with the for loop?
rust/ruby-rbs-sys/build.rs
Outdated
| let path = entry.path(); | ||
|
|
||
| if path.is_file() { | ||
| let path = path.to_str().unwrap().to_string(); |
There was a problem hiding this comment.
| let path = path.to_str().unwrap().to_string(); | |
| let path = path.to_str() | |
| .ok_or_else(|| format!("Invalid UTF-8 in filename: {:?}", path))? | |
| .to_string(); |
There was a problem hiding this comment.
I think this too would put a string in a place where we expect a file path.
f7071bc to
4f43565
Compare
vinistock
left a comment
There was a problem hiding this comment.
LGTM at this point. With the addition of the second crate, we may discover the need for a few adjustments, but it seems ready
| branches: | ||
| - master |
There was a problem hiding this comment.
Is the branches part necessary? We want this to run on any commit that matches the given paths, so maybe we can remove this?
7ac55a5 to
4de62ba
Compare
|
@alexcrocha This PR looks fine to me. I think rebasing on top of the latest trunk would fix the test failure. |
This establishes the foundation for using RBS functionality from Rust. - Generated FFI bindings via bindgen from RBS C headers - Set up build configuration to link with the RBS library - Added initial tests for basic functionality (constant pool, parser) - Configured workspace structure in rust/Cargo.toml The -sys crate follows Rust conventions for FFI bindings, keeping raw unsafe bindings separate from future safe API wrappers. Future commits will add a separate safe wrapper crate on top of these bindings.
|
This work has been upstreamed. |
The -sys crate follows Rust conventions for FFI bindings, keeping raw unsafe bindings separate from future safe API wrappers.
Future commits will add a separate safe wrapper crate on top of these bindings.